Page({
  data:{
    tap:'true',
    srlist:[],
    zclist:[],
    srtotal:0,
    zctotal:0,
    date:'2021-12-06'
  },
  click(e){
    let c = e.currentTarget.dataset.name
    if(c=='sr'){
      this.setData({
        tap:true
      })
    }else{
      this.setData({
        tap:false
      })
    }
  },
  add(){
    this.setData({
      wq:!this.data.wq
    })
  },
  tapp(e){
    console.log(e)
    let je = Number(e.detail.value)
    let date =this.data.date
    let now ='sr'
    if(!this.data.tap) now ='zc'
    let list=this.data[now+'list'],total=this.data[now+'total']
    list.push(date+'—'+je)
    total=list.reduce((sum,v)=>{
      return sum+=Number(v.split('—')[1])
    },0)
    this.setData({
      [now+'list']:list,
      [now+'total']:total,
      wq:false
    })
  },
  sj(e){
    console.log(e)
    let date=e.detail.value
    this.setData({
      date:date
    })
  }
})